//
//  HomeTableViewCell.swift
//  微博
//
//  Created by admin on 2018/3/27.
//  Copyright © 2018年 xm. All rights reserved.
//

import UIKit

class HomeTableViewCell: UITableViewCell {
    
    @IBOutlet weak var headImage: UIImageView!
    @IBOutlet weak var vipImage: UIImageView!
    @IBOutlet weak var userNameLb: UILabel!
    @IBOutlet weak var userLeveIv: UIImageView!
    @IBOutlet weak var timeLb: UILabel!
    @IBOutlet weak var fromLb: UILabel!
    @IBOutlet weak var contentLb: UILabel!
    @IBOutlet weak var statusToolBar: StatusToolBar!
    @IBOutlet weak var statusPictureView: StatusPictureView!
    @IBOutlet weak var retweetedStatusLb: UILabel?
    
    var statusViewModel:HomeStatusViewModel?{
        didSet{
            headImage.sd_setImage(urlString: statusViewModel?.status?.user?.profile_image_url, placeholderImage: UIImage(named: "avatar_default"), isAvatar: true)
            vipImage.image=statusViewModel?.verifiedImage//认证图，VIP
            userNameLb.text=statusViewModel?.status?.user?.name//用户名
            userLeveIv.image=statusViewModel?.mbrankImage//用户等级
            timeLb.text=statusViewModel?.createdAtText//创建时间
            fromLb.text=statusViewModel?.sourceText//来源
            contentLb.text=statusViewModel?.status?.text//微博内容
            //设置数据
            statusToolBar.homeStatusViewModel=statusViewModel//微博底部点赞、转发、评论等工具条
            statusPictureView.homeStatusViewModel=statusViewModel//微博配图
            //设置被转发微博的原创微博 文字内容
            retweetedStatusLb?.text = statusViewModel?.retweetedContentStr//转发微博，被转发内容
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        self.selectionStyle = .none;
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
    }
    
}
